package com.Java.train.business.controller.daily;

import com.Java.train.business.service.daily.DailyTrainSeatService;
import com.Java.train.common.response.CommonResp;
import com.Java.train.business.entity.DTO.DailyTrainSeatDTO;
import com.Java.train.business.req.daily.DailyTrainSeatQueryReq;
import com.Java.train.common.response.PageResp;
import com.Java.train.business.entity.DailyTrainSeat;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import java.util.List;
/**
* @author luomoxingchen
* @since 2024-09-24
*/
@RestController
@RequestMapping("/admin/daily-train-seat")
public class DailyTrainSeatController {

    @Autowired
    private DailyTrainSeatService dailyTrainSeatService;


    @GetMapping("/query-list")
    @ApiOperation("DailyTrainSeat查询全部")
    public CommonResp< PageResp<DailyTrainSeatDTO>> queryList(@Valid DailyTrainSeatQueryReq dailyTrainSeatQueryReq){
        PageResp<DailyTrainSeatDTO> list = dailyTrainSeatService.queryList(dailyTrainSeatQueryReq);
        return new CommonResp<>(list);
    }

    @PostMapping("/save")
    @ApiOperation("DailyTrainSeat修改")
    public CommonResp<Object> update(@Valid @RequestBody DailyTrainSeat dailyTrainSeat) {
        return dailyTrainSeatService.modify(dailyTrainSeat);
    }


    @DeleteMapping(value = "/delete/{ids}")
    @ApiOperation("DailyTrainSeat删除(单个条目)")
    public CommonResp<Object> remove(@NotBlank(message = "{required}") @PathVariable String ids) {
        return dailyTrainSeatService.remove(ids);
    }
}
